package com.wx.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
public class SchedulingService {

    private static final Logger logger = LoggerFactory.getLogger(SchedulingService.class);

    private final SleuthService sleuthService;

    public SchedulingService(SleuthService sleuthService) {
        this.sleuthService = sleuthService;
    }

    @Scheduled(cron = "0/3 * * * * *")
    public void scheduledWork() {
        logger.info("Start some work from the scheduled task");
        sleuthService.asyncMethod();
        logger.info("End work from scheduled task");
    }
}